package com.briup.cms.api;

import com.baidu.aip.ocr.AipOcr;

public class Aipocr {
    //设置APPID/AK/SK
    public static final String APP_ID = "23771732";
    public static final String API_KEY = "Qkk0vORpsvxKVFeLOvYHQwF6";
    public static final String SECRET_KEY = "n0VCi89G2zVE3fvZhOlEA9P80WpZEGG4";

    // 2.本类内部创建对象实例
    private static AipOcr instance = null;

    /**
     * 1.构造方法私有化，外部不能new
     */
    private Aipocr() {}

    // 3.提供一个公有的静态方法，返回实例对象
    public static AipOcr getInstance() {
        if (instance == null) {
            instance =  new AipOcr(APP_ID, API_KEY, SECRET_KEY);
//
            // 可选：设置网络连接参数
            instance.setConnectionTimeoutInMillis(2000);
            instance.setSocketTimeoutInMillis(60000);
        }
        return instance;
    }

}
